/*
 * @Descripttion: 
 * @version: 
 * @Author: zhaomangang
 * @Date: 2024-06-25 16:34:03
 * @LastEditors: zhaomangang
 * @LastEditTime: 2024-06-30 16:08:47
 */


#include "../include/speech_recognition.h"
#include "../include/audio_capture.h"
#include "../include/common.h"

SpeechRecognition::SpeechRecognition(QObject* parent)
    : QObject(parent)
{
    audio_capture_ = std::make_shared<AudioCapture>();
    recognition_baidu_ = std::make_shared<RecognitionBaiDu>();  
}

SpeechRecognition::~SpeechRecognition()
{
}

void SpeechRecognition::startRecognition()
{
    audio_capture_->startCapture("./temp.pcm");
}

void SpeechRecognition::stopRecognition()
{
    audio_capture_->stopCapture();
    QString text = recognition_baidu_->speechIdentify("./temp.pcm");
    RB_DEBUG << text;
}
